import request from '@/utils/request'
import store from '@/store'
let org_code = { org_code: store.getters.org_code }

/** 根据机构代码获取交换服务信息 */
export function Client_orgcode_clientserver (data) {
	return request({
		method: 'get',
		url: `/Client/${org_code.org_code}/client-server`,
		data: data
	})
}

/** 新增交换服务 */
export function Client_clientserver (data) {
	return request({
		method: 'post',
		url: '/Client/client-server',
		data: Object.assign(data, org_code)
	})
}

/** 更新交换服务 */
export function Client_id_clientserver (data) {
	return request({
		method: 'put',
		url: '/Client/{id}/client-server',
		data: Object.assign(data, org_code)
	})
}

/** 获取交换任务配置详情 */
export function Client_serverjobId_clientserverjob (data) {
	return request({
		method: 'get',
		url: '/Client/{serverjobId}/clientserverjob',
		data: data
	})
}

/** 创建交换服务执行任务 */
export function addServerJob (data) {
	return request({
		method: 'post',
		url: '/Client/client-server-job',
		data: data
	})
}

/** 获取服务执行任务列表 */
export function Client_clientserverjob (data) {
	return request({
		method: 'get',
		url: '/Client/clientserverjob',
		data: data
	})
}

/** 获取交换服务任务配置参数 */
export function get_client_params (params) {
	return request({
		method: 'get',
		url: `/Client/${params.job_id}/client-job-param`
	})
}

/** 获取任务配置执行参数 */
export function Client_jobid_clientserverparam (data) {
	return request({
		method: 'get',
		url: '/Client/{jobid}/clientserverparam',
		data: data
	})
}

/** 删除执行任务 */
export function delete_client_job (data) {
	return request({
		method: 'delete',
		url: `/Client/${data.id}/client-server-job`
	})
}

/** 删除采集任务 */
export function delete_client_serve (data) {
	return request({
		method: 'delete',
		url: `/Client/{data.id}/client-server`
	})
}

/** 获取所有父级任务 / 或者是子任务 */
export function get_task_list (params) {
	return request({
		method: 'get',
		url: '/Client/client-job-list',
		params
	})
}

/** 获取所有父级子任务 */
export function get_task_child_list (params) {
	return request({
		method: 'get',
		url: '/Client/client-job-list',
		params
	})
}

// 获取任务执行列表
export function get_server_list (params) {
	return request({
		method: 'get',
		url: `/Client/${params.id}/client-server-job`
	})
}
